<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

Route::get('think', function () {
    return 'hello,ThinkPHP6!';
});

Route::get('hello/:name', 'index/hello');
// 单个路由组
// http://localhost:8000/user.user/login
//Route::get('user/user/login', 'app\controller\user\User@login');
// 创建路由组
//http://localhost:8000/user.user/profile
Route::group('user/user', function () {
    Route::post('login', 'user/User@login');
    Route::get('register', 'user/User@register');
    Route::get('protectedApi', 'user/User@protectedApi');
    // 其他路由
});
//// api版本控制
//$v = request()->header('Api-Version');
//// 默认api版本为v1
//if ($v == null) $v = "v1";
//
//// 用户
//Route::group('user', function () {
//    Route::post('login', 'login');
//})->prefix($v.'.user/')->pattern(['id' => '\d+']);

